class Stack:
    def __init__(self):
        self.items = []
    
    def isEmpty(self):
        return self.items == []
    
    def push(self, item):
        self.items.append(item)
    
    def pop(self):
        return self.items.pop()
    
    def peek(self):
        return self.items[len(self.items)-1]
    
    def size(self):
        return len(self.items)
    
def postfixEval(postfixExpr):
    openrandStack = Stack()

    tokenList = postfixExpr.split()

    for token in tokenList:
        if token in "0123456789":
            openrandStack.push(int(token))
            print(int(token))
        else:
            operand2 = openrandStack.pop()
            operand1 = openrandStack.pop()
            result = doMath(token, operand1, operand2)
            openrandStack.push(result)
    
    return openrandStack.pop()
def doMath(op, op1, op2):
    if op == "*":
        return op1*op2
    elif op == "/":
        return op1/op2
    elif op == "+":
        return op1+op2
    else:
        return op1-op2
print(postfixEval("27+9*"))